package com.ccc.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * RoleProduct entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "role_product")
public class RoleProduct implements java.io.Serializable {

	// Fields

	private Integer id;
	private Product product;
	private Role role;
	private Integer startCount;
	private Integer cycle;

	// Constructors

	public Integer getCycle() {
		return cycle;
	}

	public void setCycle(Integer cycle) {
		this.cycle = cycle;
	}

	/** default constructor */
	public RoleProduct() {
	}

	/** full constructor */
	public RoleProduct(Product product, Role role, Integer startCount) {
		this.product = product;
		this.role = role;
		this.startCount = startCount;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "productId", nullable = false)
	public Product getProduct() {
		return this.product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "roleId", nullable = false)
	public Role getRole() {
		return this.role;
	}

	public void setRole(Role role) {
		this.role = role;
	}

	@Column(name = "startCount", nullable = false)
	public Integer getStartCount() {
		return this.startCount;
	}

	public void setStartCount(Integer startCount) {
		this.startCount = startCount;
	}

}